using GLib;
using Posix;

[CCode (cheader_filename = "liberscribble/scbstroke.h")]
namespace liberscribble {

    [CCode (cprefix="ERSCRIBBLE_DEV_COLOR_")]
    public enum DeviceColor {
        WHITE      = 0,
        LIGHT_GRAY = 1,
        DARK_GRAY  = 2,
        BLACK      = 3,
        UNKNOWN    = 0xFFFFFFFF
    }

    [CCode (cname = "ScbStrokeAttributes")]
    public struct StrokeAttributes {
        public DeviceColor color;
        public float zoom;
        public int layer;
        public int shape_id;
        public int size_id;
        public int points_number;
    }

    [CCode (cname = "ScbPoint")]
    public struct Point {
        public int x;
        public int y;
    }

    [CCode (cname = "ScbDevPoint")]
    public struct DevicePoint {
        public Point point;
        public int pressure;
    }

    [Compact]
    [CCode (cname = "ScbStroke", cprefix = "erscribble_stroke_", free_function="erscribble_stroke_free")]
    public class Stroke {
        [CCode (cname = "erscribble_stroke_new_with_attributes")]
        public Stroke(StrokeAttributes attr);
        public int get_point_count();
        public Point[] get_point_data();
        public int add_point(DevicePoint point);
        public void driver_draw_point(DevicePoint point, bool is_last_point);
        public void driver_draw();
    }

    [CCode (cheader_filename = "liberscribble/driver.h", cname="erscribble_driver_init")]
    public static void driver_init();
    [CCode (cheader_filename = "liberscribble/driver.h", cname="erscribble_driver_close")]
    public static void driver_close();
}
